package com.qidian.tcba.admin.api.controller;


import com.qidian.tcba.admin.model.dto.district.DistrictListDTO;
import com.qidian.tcba.admin.service.DistrictService;
import com.qidian.tcba.utils.*;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.xml.bind.util.JAXBSource;
import java.util.List;
import java.util.Map;

/**
 * <p>
 * 区县表 前端控制器
 * </p>
 *
 * @author 冯永龙
 * @since 2021-07-06
 */
@RestController
@RequestMapping("/district")
@Api(tags ="区县")
public class DistrictController {
    @Autowired
    private DistrictService districtService;

    @ApiOperation("获取区县列表")
    @GetMapping("/getList")
    public JSONResult<List<DistrictListDTO>> getDistrictList(){
        JSONResult<List<DistrictListDTO>> jsonResult = new JSONResult();
        Map<Integer,List<DistrictListDTO>> districtList = districtService.getDistrictList();
        jsonResult.setData(districtList.get(1));
        return jsonResult;
    }
}

